<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0"><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />   
        <title>Welcome to Design Zone......</title>
        <link rel="stylesheet" type="text/css" href="../../scripts/ext/resources/css/ext-all.css" />
		<link rel="stylesheet" type="text/css" href="../../scripts/ext/resources/css/file-upload.css" />
        <link rel="stylesheet" type="text/css" href="../../styles/dzbase.css" />
        <script type="text/javascript" src="../../scripts/ext/adapter/ext-base.js">
        </script>
        <script type="text/javascript" src="../../scripts/ext/ext-all.js">
        </script>
		<script type="text/javascript" src="../../scripts/form/FileUploadField.js">
        </script>
		<script type="text/javascript" src="../../scripts/grid/GroupSummary.js">
        </script>
		<script type="text/javascript" src="../../scripts/grid/RowExpander.js">
        </script>
        <script type="text/javascript" src="../../scripts/menu/EditableItem.js">
        </script>
        <script type="text/javascript" src="../../scripts/menu/RangeMenu.js">
        </script>
		<script type="text/javascript" src="../../scripts/grid/GridFilters.js">
        </script>
        <script type="text/javascript" src="../../scripts/grid/filter/Filter.js">
        </script>
        <script type="text/javascript" src="../../scripts/grid/filter/StringFilter.js">
        </script>
        <script type="text/javascript" src="../../scripts/grid/filter/ListFilter.js">
        </script>
        <script type="text/javascript" src="../../scripts/i18nMessage.js">
        </script>
        <script type="text/javascript" src="../../scripts/utils.js">
        </script>
		<script type="text/javascript" src="../../scripts/selectPantone.js">
        </script>
		<script type="text/javascript" src="../../scripts/selectBiFactory.js">
        </script>
        <script type="text/javascript">
            var yarnMessage = new i18nMessage('../../servlet/I18nMessageServlet?keyPrefix=ui.yarn');
			var fcMessage = new i18nMessage('../../servlet/I18nMessageServlet?keyPrefix=ui.factory');
            var message = new i18nMessage('../../servlet/I18nMessageServlet?keyPrefix=message');
			
			var ctYesnoXmlLoader = new xmlLoader('../../servlet/CodeTableServlet?name=CtYesno');
			var ctYarnTypeXmlLoader = new xmlLoader('../../servlet/CodeTableServlet?name=CtYarnType');
			var ctYarnMaterialXmlLoader = new xmlLoader('../../servlet/CodeTableServlet?name=CtYarnMaterial');
			var ctYarnMeasureXmlLoader = new xmlLoader('../../servlet/CodeTableServlet?name=CtYarnMeasure');
			var ctYarnTwistXmlLoader = new xmlLoader('../../servlet/CodeTableServlet?name=CtYarnTwist');
			var ctYarnShapeXmlLoader = new xmlLoader('../../servlet/CodeTableServlet?name=CtYarnShape');
			
			var ctYesnoStore = new Ext.data.Store({
                reader: new Ext.data.XmlReader({
                    record: 'item',
                    id: 'code',
                    totalRecords: 'itemTotal'
                }, ['code', 'description']),
                data: ctYesnoXmlLoader.getXml()
            });
			
			var ctYarnTypeStore = new Ext.data.Store({
                reader: new Ext.data.XmlReader({
                    record: 'item',
                    id: 'code',
                    totalRecords: 'itemTotal'
                }, [ 
                'code', 'description']),
				data: ctYarnTypeXmlLoader.getXml()
            });
			
			var ctYarnMaterialStore = new Ext.data.Store({
                reader: new Ext.data.XmlReader({
                    record: 'item',
                    id: 'code',
                    totalRecords: 'itemTotal'
                }, [ 
                'code', 'description']),
				data: ctYarnMaterialXmlLoader.getXml()
            });
			
			var ctYarnMeasureStore = new Ext.data.Store({
                reader: new Ext.data.XmlReader({
                    record: 'item',
                    id: 'code',
                    totalRecords: 'itemTotal'
                }, [ 
                'code', 'description']),
				data: ctYarnMeasureXmlLoader.getXml()
            });
			
			var ctYarnTwistStore = new Ext.data.Store({
                reader: new Ext.data.XmlReader({
                    record: 'item',
                    id: 'code',
                    totalRecords: 'itemTotal'
                }, [ 
                'code', 'description']),
				data: ctYarnTwistXmlLoader.getXml()
            });
			
			var ctYarnShapeStore = new Ext.data.Store({
                reader: new Ext.data.XmlReader({
                    record: 'item',
                    id: 'code',
                    totalRecords: 'itemTotal'
                }, [ 
                'code', 'description']),
				data: ctYarnShapeXmlLoader.getXml()
            });
			
			var ctYarnTypeCombo;
			var ctYarnMaterialCombo1;
			var ctYarnMaterialCombo2;
			var ctYarnMaterialCombo3;
			var ctYarnMaterialCombo4;
			var ctYarnMaterialCombo5;
			var ctYarnMeasureCombo;
			var ctYarnTwistCombo1;
			var ctYarnTwistCombo2;
			var ctYarnTwistCombo3;
			var ctYarnShapeCombo;
			var isStockServiceCombo;
			var selectedFactory;
			
			var selectPantoneCallback = function(pantone, realColor){
                document.getElementById('pantoneColor').value = pantone;
                document.getElementById('realColor').value = realColor;
                document.getElementById('sampleTable').style['backgroundColor'] = '#' + realColor;
            }
			
			var selectFactoryCallback = function(factoryId, factoryName){
				document.getElementById('factoryId').value = factoryId;
				document.getElementById('factoryNameCN').value = selectedFactory.nameCN;
                document.getElementById('factoryNameEN').value = selectedFactory.nameEN;
			}
            Ext.onReady(function(){
                Ext.QuickTips.init();
                Ext.form.Field.prototype.msgTarget = 'side';
				
				isStockServiceCombo = new Ext.form.ComboBox({
					fieldLabel: yarnMessage.get('ui.yarn.stock'),
					id: 'isStockService',
					name: 'isStockService',
					editable: false,
				    store: ctYesnoStore,
					valueField: 'code',
				    displayField:'description',
					allowBlank: false,
                    blankText: message.get('message.edit.noblank'),
				    triggerAction: 'all',
				    emptyText: message.get('message.combo.pleaseselect'),
				    selectOnFocus:true,
					anchor: '90%',
					mode: 'local'
				});
				 
				ctYarnTypeCombo = new Ext.form.ComboBox({
					fieldLabel: yarnMessage.get('ui.yarn.type'),
					id: 'ctYarnType',
					name: 'ctYarnType',
					editable: false,
				    store: ctYarnTypeStore,
					valueField: 'code',
				    displayField:'description',
					allowBlank: false,
                    blankText: message.get('message.edit.noblank'),
				    triggerAction: 'all',
				    emptyText: message.get('message.combo.pleaseselect'),
				    selectOnFocus:true,
					anchor: '90%',
					mode: 'local'
				});
				
				ctYarnTwistCombo1 = new Ext.form.ComboBox({
					fieldLabel: yarnMessage.get('ui.yarn.twist') + '1',
					id: 'ctYarnTwist1',
					name: 'ctYarnTwist1',
					editable: false,
				    store: ctYarnTwistStore,
					valueField: 'code',
				    displayField:'description',
				    triggerAction: 'all',
				    emptyText: message.get('message.combo.pleaseselect'),
				    selectOnFocus:true,
					mode: 'local',
					anchor: '90%'
				});
				
				ctYarnTwistCombo2 = new Ext.form.ComboBox({
					fieldLabel: yarnMessage.get('ui.yarn.twist') + '2',
					id: 'ctYarnTwist2',
					name: 'ctYarnTwist2',
					editable: false,
				    store: ctYarnTwistStore,
					valueField: 'code',
				    displayField:'description',
				    triggerAction: 'all',
				    emptyText: message.get('message.combo.pleaseselect'),
				    selectOnFocus:true,
					mode: 'local',
					anchor: '90%'
				});
				
				ctYarnTwistCombo3 = new Ext.form.ComboBox({
					fieldLabel: yarnMessage.get('ui.yarn.twist') + '3',
					id: 'ctYarnTwist3',
					name: 'ctYarnTwist3',
					editable: false,
				    store: ctYarnTwistStore,
					valueField: 'code',
				    displayField:'description',
				    triggerAction: 'all',
				    emptyText: message.get('message.combo.pleaseselect'),
				    selectOnFocus:true,
					mode: 'local',
					anchor: '90%'
				});
				
				ctYarnMeasureCombo = new Ext.form.ComboBox({
					fieldLabel: '',
					labelSeparator: '',
					id: 'ctYarnMeasure',
					name: 'ctYarnMeasure',
					editable: false,
				    store: ctYarnMeasureStore,
					valueField: 'code',
				    displayField:'description',
					allowBlank: false,
                    blankText: message.get('message.edit.noblank'),
				    triggerAction: 'all',
				    emptyText: message.get('message.combo.pleaseselect'),
				    selectOnFocus:true,
					mode: 'local',
					anchor: '90%'
				});
				
				ctYarnShapeCombo = new Ext.form.ComboBox({
					fieldLabel: yarnMessage.get('ui.yarn.shape'),
					id: 'ctYarnShape',
					name: 'ctYarnShape',
					editable: false,
				    store: ctYarnShapeStore,
					valueField: 'code',
				    displayField:'description',
					allowBlank: false,
                    blankText: message.get('message.edit.noblank'),
				    triggerAction: 'all',
				    emptyText: message.get('message.combo.pleaseselect'),
				    selectOnFocus:true,
					anchor: '90%',
					mode: 'local'
				});
				
				ctYarnMaterialCombo1 = new Ext.form.ComboBox({
					fieldLabel: yarnMessage.get('ui.yarn.material') + '1',
					id: 'ctYarnMaterial1',
					name: 'ctYarnMaterial1',
					editable: false,
				    store: ctYarnMaterialStore,
					valueField: 'code',
				    displayField:'description',
				    triggerAction: 'all',
				    emptyText: message.get('message.combo.pleaseselect'),
				    selectOnFocus:true,
					anchor: '90%',
					mode: 'local'
				});
				
				ctYarnMaterialCombo2 = new Ext.form.ComboBox({
					fieldLabel: yarnMessage.get('ui.yarn.material') + '2',
					id: 'ctYarnMaterial2',
					name: 'ctYarnMaterial2',
					editable: false,
				    store: ctYarnMaterialStore,
					valueField: 'code',
				    displayField:'description',
				    triggerAction: 'all',
				    emptyText: message.get('message.combo.pleaseselect'),
				    selectOnFocus:true,
					anchor: '90%',
					mode: 'local'
				});
				
				ctYarnMaterialCombo3 = new Ext.form.ComboBox({
					fieldLabel: yarnMessage.get('ui.yarn.material') + '3',
					id: 'ctYarnMaterial3',
					name: 'ctYarnMaterial3',
					editable: false,
				    store: ctYarnMaterialStore,
					valueField: 'code',
				    displayField:'description',
				    triggerAction: 'all',
				    emptyText: message.get('message.combo.pleaseselect'),
				    selectOnFocus:true,
					anchor: '90%',
					mode: 'local'
				});
				
				ctYarnMaterialCombo4 = new Ext.form.ComboBox({
					fieldLabel: yarnMessage.get('ui.yarn.material') + '4',
					id: 'ctYarnMaterial4',
					name: 'ctYarnMaterial4',
					editable: false,
				    store: ctYarnMaterialStore,
					valueField: 'code',
				    displayField:'description',
				    triggerAction: 'all',
				    emptyText: message.get('message.combo.pleaseselect'),
				    selectOnFocus:true,
					anchor: '90%',
					mode: 'local'
				});
				
				ctYarnMaterialCombo5 = new Ext.form.ComboBox({
					fieldLabel: yarnMessage.get('ui.yarn.material') + '5',
					id: 'ctYarnMaterial5',
					name: 'ctYarnMaterial5',
					editable: false,
				    store: ctYarnMaterialStore,
					valueField: 'code',
				    displayField:'description',
				    triggerAction: 'all',
				    emptyText: message.get('message.combo.pleaseselect'),
				    selectOnFocus:true,
					anchor: '90%',
					mode: 'local'
				});
                
                var idValue = getPrarmeterValue(window.location, 'id');
                var startPage = getPrarmeterValue(window.location, 'startPage');
                var yarnForm = new Ext.FormPanel({
					fileUpload: true,
                    labelAlign: 'left',
                    labelWidth: 120, 
                    url: '../../servlet/BiYarnServlet?action=1',
                    frame: true,
                    reader: new Ext.data.XmlReader({
                        record: 'item'
                    }, [{
                        name: 'id',
                        mapping: 'id'
                    },{
                        name: 'photoName',
                        mapping: 'photoName'
                    }, {
                        name: 'reference',
                        mapping: 'reference'
                    }, {
                        name: 'comment',
                        mapping: 'comment'
                    }, {
                        name: 'factoryId',
                        mapping: 'factoryId'
                    }, {
                        name: 'factoryNameCN',
                        mapping: 'factoryNameCN'
                    }, {
                        name: 'factoryNameEN',
                        mapping: 'factoryNameEN'
                    },{
						name: 'ctYarnType',
						mapping: 'ctYarnType'
					},{
						name: 'photoName',
						mapping: 'photoName'
					},{
						name: 'ctYarnType',
						mapping: 'ctYarnType'
					},{
						name: 'ctYarnMeasure',
						mapping: 'ctYarnMeasure'
					},{
						name: 'ctYarnMaterial1',
						mapping: 'ctYarnMaterial1'
					},{
						name: 'ctYarnMaterial2',
						mapping: 'ctYarnMaterial2'
					},{
						name: 'ctYarnMaterial3',
						mapping: 'ctYarnMaterial3'
					},{
						name: 'ctYarnMaterial4',
						mapping: 'ctYarnMaterial4'
					},{
						name: 'ctYarnMaterial5',
						mapping: 'ctYarnMaterial5'
					},{
						name: 'composition1',
						mapping: 'composition1'
					},{
						name: 'composition2',
						mapping: 'composition2'
					},{
						name: 'composition3',
						mapping: 'composition3'
					},{
						name: 'composition4',
						mapping: 'composition4'
					},{
						name: 'composition5',
						mapping: 'composition5'
					},{
						name: 'ctYarnShape',
						mapping: 'ctYarnShape'
					},{
						name: 'boutNumber',
						mapping: 'boutNumber'
					},{
						name: 'yarnAccount',
						mapping: 'yarnAccount'
					},{
						name: 'ctYarnTwist1',
						mapping: 'ctYarnTwist1'
					},{
						name: 'ctYarnTwist2',
						mapping: 'ctYarnTwist2'
					},{
						name: 'ctYarnTwist3',
						mapping: 'ctYarnTwist3'
					},{
						name: 'tourNumber',
						mapping: 'tourNumber'
					},{
						name: 'isCarded',
						mapping: 'isCarded'
					},{
						name: 'isSemiWorsted',
						mapping: 'isSemiWorsted'
					},{
						name: 'isWorsted',
						mapping: 'isWorsted'
					},{
						name: 'isSpinningOther1',
						mapping: 'isSpinningOther1'
					},{
						name: 'isSpinningOther2',
						mapping: 'isSpinningOther2'
					},{
						name: 'isSpinningOther3',
						mapping: 'isSpinningOther3'
					},{
						name: 'fiberLength1',
						mapping: 'fiberLength1'
					},{
						name: 'fiberLength2',
						mapping: 'fiberLength2'
					},{
						name: 'fiberLength3',
						mapping: 'fiberLength3'
					},{
						name: 'fiberLength4',
						mapping: 'fiberLength4'
					},{
						name: 'fiberLength5',
						mapping: 'fiberLength5'
					},{
						name: 'isFibre',
						mapping: 'isFibre'
					},{
						name: 'isHank',
						mapping: 'isHank'
					},{
						name: 'isBobbin',
						mapping: 'isBobbin'
					},{
						name: 'isSpace',
						mapping: 'isSpace'
					},{
						name: 'isDyeingOther1',
						mapping: 'isDyeingOther1'
					},{
						name: 'isDyeingOther2',
						mapping: 'isDyeingOther2'
					},{
						name: 'isDyeingOther3',
						mapping: 'isDyeingOther3'
					},{
                        name: 'isRaw',
                        mapping: 'isRaw'
                    }, {
                        name: 'isSolid',
                        mapping: 'isSolid'
                    }, {
                        name: 'isChine',
                        mapping: 'isChine'
                    }, {
                        name: 'isTwisted',
                        mapping: 'isTwisted'
                    }, {
                        name: 'isFancy',
                        mapping: 'isFancy'
                    }, {
                        name: 'isYarnOther1',
                        mapping: 'isYarnOther1'
                    }, {
                        name: 'isYarnOther2',
                        mapping: 'isYarnOther2'
                    }, {
                        name: 'isYarnOther3',
                        mapping: 'isYarnOther3'
                    }, {
                        name: 'isStockService',
                        mapping: 'isStockService'
                    }, {
                        name: 'minDyeingTime1',
                        mapping: 'minDyeingTime1'
                    }, {
                        name: 'deliveryTime1',
                        mapping: 'deliveryTime1'
                    }, {
                        name: 'price1',
                        mapping: 'price1'
                    }, {
                        name: 'minDyeingTime2',
                        mapping: 'minDyeingTime2'
                    }, {
                        name: 'deliveryTime2',
                        mapping: 'deliveryTime2'
                    }, {
                        name: 'price2',
                        mapping: 'price2'
                    }, {
                        name: 'minDyeingTime3',
                        mapping: 'minDyeingTime3'
                    }, {
                        name: 'deliveryTime3',
                        mapping: 'deliveryTime3'
                    }, {
                        name: 'price3',
                        mapping: 'price3'
                    }, {
                        name: 'studyDeadline1',
                        mapping: 'studyDeadline1'
                    }]),
                    title: yarnMessage.get('ui.yarn.edittitle'),
                    bodyStyle: 'padding:5px 5px 5px 5px',
                    defaults: {
                        width: '90%'
                    },
                    
                    items: [{
                        id: 'id',
                        name: 'id',
                        xtype: 'hidden'
                    },{
                        id: 'factoryId',
                        name: 'factoryId',
                        xtype: 'hidden'
                    },{
						id: 'photoName',
                        name: 'photoName',
                        xtype: 'hidden'
                    }, {
                            layout: 'column',
                            items: [{
                                columnWidth: .33,
                                layout: 'form',
                                items: [{
									id: 'reference',
                                    name: 'reference',
                                    fieldLabel: message.get('message.edit.reference'),
                                    xtype: 'textfield',
                                    anchor: '86%',
									width: '90%',
                                    allowBlank: false,
                                    blankText: message.get('message.edit.noblank'),
                                    maxLength: 64
                                },{
									id: 'factoryNameCN',
                                    name: 'factoryNameCN',
                                    fieldLabel: fcMessage.get('ui.factory.name'),
                                    xtype: 'textfield',
                                    anchor: '86%',
									width: '90%',
                                    allowBlank: false,
                                    blankText: message.get('message.edit.noblank'),
									emptyText: message.get('message.combo.pleaseselect'),
									readOnly: true,
                                    maxLength: 128,
									listeners: {
                                        'render': {
                                            fn: function(){
                                                Ext.getCmp('factoryNameCN').getEl().on('click', function(){
                                                    selectFactory();
                                                }, this);
                                            },
                                            scope: this
                                        }
                                    }
                                },ctYarnMeasureCombo]
							},{
                                columnWidth: .33,
                                layout: 'form',
                                items: [ctYarnTypeCombo,{
									id: 'factoryNameEN',
                                    name: 'factoryNameEN',
                                    hideLabel: true,
                                    xtype: 'textfield',
                                    anchor: '60%',
									width: '60%',
                                    allowBlank: false,
									readOnly: true,
                                    maxLength: 128
                                }]
							},{
                                columnWidth: .33,
                                layout: 'form',
                                items: [{
									xtype: 'fileuploadfield',
									width: '80%',
						            id: 'photo',
						            emptyText: message.get('message.edit.selectimage'),
						            fieldLabel: message.get('message.edit.photo'),
						            name: 'photo',
						            buttonCfg: {
						                text: '',
						                iconCls: 'uploadIcon'
					            	}
								},ctYarnShapeCombo]
							}]
						},{
							xtype: 'fieldset',
							collapsible: true,
							title: yarnMessage.get('ui.yarn.composition'),
							autoHeight: true,
							items: [{
	                            layout: 'column',
	                            items: [{
	                                columnWidth: .33,
	                                layout: 'form',
	                                items: [ctYarnMaterialCombo1, ctYarnMaterialCombo2, ctYarnMaterialCombo3, ctYarnMaterialCombo4, ctYarnMaterialCombo5]
								
								},{
	                                columnWidth: .33,
	                                layout: 'form',
	                                items: [{
										id: 'composition1',
	                                    name: 'composition1',
	                                    fieldLabel: yarnMessage.get('ui.yarn.composition') + '1&nbsp;(%)',
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'composition2',
	                                    name: 'composition2',
	                                    fieldLabel: yarnMessage.get('ui.yarn.composition') + '2&nbsp;(%)',
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'composition3',
	                                    name: 'composition3',
	                                    fieldLabel: yarnMessage.get('ui.yarn.composition') + '3&nbsp;(%)',
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'composition4',
	                                    name: 'composition4',
	                                    fieldLabel: yarnMessage.get('ui.yarn.composition') + '4&nbsp;(%)',
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'composition5',
	                                    name: 'composition5',
	                                    fieldLabel: yarnMessage.get('ui.yarn.composition') + '5&nbsp;(%)',
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                }]
								},{
	                                columnWidth: .33,
	                                layout: 'form',
	                                items: [{
										id: 'fiberLength1',
	                                    name: 'fiberLength1',
	                                    fieldLabel: yarnMessage.get('ui.yarn.fiberlength') + '1',
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'fiberLength2',
	                                    name: 'fiberLength2',
	                                    fieldLabel: yarnMessage.get('ui.yarn.fiberlength') + '2',
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'fiberLength3',
	                                    name: 'fiberLength3',
	                                    fieldLabel: yarnMessage.get('ui.yarn.fiberlength') + '3',
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'fiberLength4',
	                                    name: 'fiberLength4',
	                                    fieldLabel: yarnMessage.get('ui.yarn.fiberlength') + '4',
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'fiberLength5',
	                                    name: 'fiberLength5',
	                                    fieldLabel: yarnMessage.get('ui.yarn.fiberlength') + '5',
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                }]
								}]
							}]
						},{
							xtype: 'fieldset',
							collapsible: true,
							title: yarnMessage.get('ui.yarn.titrage'),
							autoHeight: true,
							items: [{
	                            layout: 'column',
	                            items: [{
	                                columnWidth: .33,
	                                layout: 'form',
	                                items: [ctYarnMeasureCombo,ctYarnTwistCombo1]
								
								},{
	                                columnWidth: .33,
	                                layout: 'form',
	                                items: [{
										id: 'yarnAccount',
	                                    name: 'yarnAccount',
	                                    fieldLabel: yarnMessage.get('ui.yarn.yarnaccount'),
	                                    xtype: 'textfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },ctYarnTwistCombo2]
								},{
	                                columnWidth: .33,
	                                layout: 'form',
	                                items: [{
										id: 'tourNumber',
	                                    name: 'tourNumber',
	                                    fieldLabel: yarnMessage.get('ui.yarn.tournumber'),
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },ctYarnTwistCombo3]
								
								}]
							}]
						}, {
							xtype: 'fieldset',
							collapsible: true,
							title: yarnMessage.get('ui.yarn.feature'),
							autoHeight: true,
							items: [{
	                            layout: 'column',
	                            items: [{
	                                columnWidth: .33,
	                                layout: 'form',
	                                items: [{
									id: 'isCarded',
									name: 'isCarded',
									fieldLabel: fcMessage.get('ui.factory.spinningtype'),
									xtype: 'checkbox',
									boxLabel: fcMessage.get('ui.factory.carded')
								},{
									id: 'isSemiWorsted',
									name: 'isSemiWorsted',
									fieldLabel: '',
									labelSeparator: '',
									xtype: 'checkbox',
									boxLabel: fcMessage.get('ui.factory.semiworsted')
								},{
									id: 'isWorsted',
									name: 'isWorsted',
									fieldLabel: '',
									labelSeparator: '',
									xtype: 'checkbox',
									boxLabel: fcMessage.get('ui.factory.worsted')
								},{
									id: 'isSpinningOther1',
									name: 'isSpinningOther1',
									fieldLabel: '',
									labelSeparator: '',
									xtype: 'checkbox',
									boxLabel: fcMessage.get('ui.factory.spinningother') + '1'
								},{
									id: 'isSpinningOther2',
									name: 'isSpinningOther2',
									fieldLabel: '',
									labelSeparator: '',
									xtype: 'checkbox',
									boxLabel: fcMessage.get('ui.factory.spinningother')+ '2'
								},{
									id: 'isSpinningOther3',
									name: 'isSpinningOther3',
									fieldLabel: '',
									labelSeparator: '',
									xtype: 'checkbox',
									boxLabel: fcMessage.get('ui.factory.spinningother')+ '3'
								}]
								
								},{
	                                columnWidth: .33,
	                                layout: 'form',
	                                items: [{
									id: 'isFibre',
									name: 'isFibre',
									fieldLabel: fcMessage.get('ui.factory.dyeing'),
									xtype: 'checkbox',
									boxLabel: fcMessage.get('ui.factory.fibre')
								},{
									id: 'isHank',
									name: 'isHank',
									fieldLabel: '',
									labelSeparator: '',
									xtype: 'checkbox',
									boxLabel: fcMessage.get('ui.factory.hank')
								},{
									id: 'isBobbin',
									name: 'isBobbin',
									fieldLabel: '',
									labelSeparator: '',
									xtype: 'checkbox',
									boxLabel: fcMessage.get('ui.factory.bobbin')
								},{
									id: 'isSpace',
									name: 'isSpace',
									fieldLabel: '',
									labelSeparator: '',
									xtype: 'checkbox',
									boxLabel: fcMessage.get('ui.factory.space')
								},{
									id: 'isDyeingOther1',
									name: 'isDyeingOther1',
									fieldLabel: '',
									labelSeparator: '',
									xtype: 'checkbox',
									boxLabel: fcMessage.get('ui.factory.dyeingother') + '1'
								},{
									id: 'isDyeingOther2',
									name: 'isDyeingOther2',
									fieldLabel: '',
									labelSeparator: '',
									xtype: 'checkbox',
									boxLabel: fcMessage.get('ui.factory.dyeingother') + '2'
								},{
									id: 'isDyeingOther3',
									name: 'isDyeingOther3',
									fieldLabel: '',
									labelSeparator: '',
									xtype: 'checkbox',
									boxLabel: fcMessage.get('ui.factory.dyeingother') + '3'
								}]},{
		                                columnWidth: .33,
		                                layout: 'form',
		                                items: [{
										id: 'isRaw',
										name: 'isRaw',
										fieldLabel: fcMessage.get('ui.factory.yarn'),
										xtype: 'checkbox',
										boxLabel: fcMessage.get('ui.factory.raw')
									},{
										id: 'isSolid',
										name: 'isSolid',
										fieldLabel: '',
										labelSeparator: '',
										xtype: 'checkbox',
										boxLabel: fcMessage.get('ui.factory.solid')
									},{
										id: 'isChine',
										name: 'isChine',
										fieldLabel: '',
										labelSeparator: '',
										xtype: 'checkbox',
										boxLabel: fcMessage.get('ui.factory.chine')
									},{
										id: 'isTwisted',
										name: 'isTwisted',
										fieldLabel: '',
										labelSeparator: '',
										xtype: 'checkbox',
										boxLabel: fcMessage.get('ui.factory.mouline')
									},{
										id: 'isFancy',
										name: 'isFancy',
										fieldLabel: '',
										labelSeparator: '',
										xtype: 'checkbox',
										boxLabel: fcMessage.get('ui.factory.fancy')
									},{
										id: 'isYarnOther1',
										name: 'isYarnOther1',
										fieldLabel: '',
										labelSeparator: '',
										xtype: 'checkbox',
										boxLabel: fcMessage.get('ui.factory.yarnother') + '1'
									},{
										id: 'isYarnOther2',
										name: 'isYarnOther2',
										fieldLabel: '',
										labelSeparator: '',
										xtype: 'checkbox',
										boxLabel: fcMessage.get('ui.factory.yarnother') + '2'
									},{
										id: 'isYarnOther3',
										name: 'isYarnOther3',
										fieldLabel: '',
										labelSeparator: '',
										xtype: 'checkbox',
										boxLabel: fcMessage.get('ui.factory.yarnother') + '3'
									}]
								}]
							}]
						},{
							xtype: 'fieldset',
							collapsible: true,
							title: yarnMessage.get('ui.yarn.industrial'),
							autoHeight: true,
							items: [{
	                            layout: 'column',
	                            items: [{
	                                columnWidth: .33,
	                                layout: 'form',
	                                items: [isStockServiceCombo,{
										id: 'minDyeingTime1',
	                                    name: 'minDyeingTime1',
	                                    fieldLabel: yarnMessage.get('ui.yarn.miniprod'),
	                                    xtype: 'textfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'deliveryTime1',
	                                    name: 'deliveryTime1',
	                                    fieldLabel: yarnMessage.get('ui.yarn.delaydelivery') + '1',
	                                    xtype: 'textfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'price1',
	                                    name: 'price1',
	                                    fieldLabel: yarnMessage.get('ui.yarn.unitprice') + '1',
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'studyDeadline1',
	                                    name: 'studyDeadline1',
	                                    fieldLabel: yarnMessage.get('ui.yarn.colorstudy'),
	                                    xtype: 'textfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                }]
								},{
	                                columnWidth: .33,
	                                layout: 'form',
	                                items: [{
										html: '<div class="div"><label class="x-form-item-label">&nbsp;<br/><br/></label></div>'
									},{
										id: 'minDyeingTime2',
	                                    name: 'minDyeingTime2',
	                                    fieldLabel: yarnMessage.get('ui.yarn.minproduction'),
	                                    xtype: 'textfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'deliveryTime2',
	                                    name: 'deliveryTime2',
	                                    fieldLabel: yarnMessage.get('ui.yarn.delaydelivery') + '2',
	                                    xtype: 'textfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'price2',
	                                    name: 'price2',
	                                    fieldLabel: yarnMessage.get('ui.yarn.unitprice') + '2',
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                }]
								},{
	                                columnWidth: .33,
	                                layout: 'form',
	                                items: [{
										html: '<div class="div"><label class="x-form-item-label">&nbsp;<br/><br/></label></div>'
									},{
										id: 'minDyeingTime3',
	                                    name: 'minDyeingTime3',
	                                    fieldLabel: yarnMessage.get('ui.yarn.minisample'),
	                                    xtype: 'textfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'deliveryTime3',
	                                    name: 'deliveryTime3',
	                                    fieldLabel: yarnMessage.get('ui.yarn.delaydelivery') + '3',
	                                    xtype: 'textfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                },{
										id: 'price3',
	                                    name: 'price3',
	                                    fieldLabel: yarnMessage.get('ui.yarn.unitprice') + '3',
	                                    xtype: 'numberfield',
	                                    anchor: '86%',
										width: '90%',
	                                    maxLength: 64
	                                }]
								
								}]
							}]
						},{
							id: 'comment',
                            name: 'comment',
                            fieldLabel: message.get('message.edit.comment'),
                            xtype: 'textarea',
                            anchor: '86%',
							width: '90%',
                            maxLength: 512
                        }],
                    
                    buttons: [{
                        text: message.get('message.edit.save'),
                        handler: function(){
                            if (yarnForm.getForm().isValid()) {
//								var ctYarnTypeCombo;
//								var ctYarnMaterialCombo1;
//								var ctYarnMaterialCombo2;
//								var ctYarnMaterialCombo3;
//								var ctYarnMaterialCombo4;
//								var ctYarnMaterialCombo5;
//								var ctYarnMeasureCombo;
//								var ctYarnTwistCombo1;
//								var ctYarnTwistCombo2;
//								var ctYarnTwistCombo3;
//								var ctYarnShapeCombo;
//								var isStockServiceCombo;
								var composition1 = Ext.getCmp('composition1').getValue();
								var composition2 = Ext.getCmp('composition2').getValue();
								var composition3 = Ext.getCmp('composition3').getValue();
								var composition4 = Ext.getCmp('composition4').getValue();
								var composition5 = Ext.getCmp('composition5').getValue();
								
								if((composition1 + composition2 + composition3 + composition4 + composition5) != 100){
									messageTip.msg(message.get('message.tip'), yarnMessage.get('ui.yarn.totalerror'));
									return;
								}
																
								
								document.getElementsByName('ctYarnType')[0].value = ctYarnTypeCombo.getValue();
								document.getElementsByName('ctYarnMaterial1')[0].value = ctYarnMaterialCombo1.getValue();
								document.getElementsByName('ctYarnMaterial2')[0].value = ctYarnMaterialCombo2.getValue();
								document.getElementsByName('ctYarnMaterial3')[0].value = ctYarnMaterialCombo3.getValue();
								document.getElementsByName('ctYarnMaterial4')[0].value = ctYarnMaterialCombo4.getValue();
								document.getElementsByName('ctYarnMaterial5')[0].value = ctYarnMaterialCombo5.getValue();
								
								document.getElementsByName('ctYarnMeasure')[0].value = ctYarnMeasureCombo.getValue();
								document.getElementsByName('ctYarnTwist1')[0].value = ctYarnTwistCombo1.getValue();
								document.getElementsByName('ctYarnTwist2')[0].value = ctYarnTwistCombo2.getValue();
								document.getElementsByName('ctYarnTwist3')[0].value = ctYarnTwistCombo3.getValue();
								
								document.getElementsByName('ctYarnShape')[0].value = ctYarnShapeCombo.getValue();
								document.getElementsByName('isStockService')[0].value = isStockServiceCombo.getValue();
								
                                yarnForm.getForm().submit({
                                    method: 'post',
                                    success: function(form, action){
                                        //alert(form);
                                        messageTip.msg(message.get('message.tip'), message.get('message.edit.successful'));
                                        yarnForm.getForm().reset();
                                        //yarnForm.show();
                                    },
                                    failure: function(form, action){
                                        //alert(form);
                                        messageTip.msg(message.get('message.tip'), message.get('message.edit.unsuccessful'));
                                        //yarnForm.show();
                                    }
                                });
                            }
                        }
                    }, {
                        text: message.get('message.edit.reset'),
                        handler: function(){
                            msItemForm.getForm().reset();
                        }
                    }, {
                        text: message.get('message.edit.cancel'),
                        handler: function(){
                            if (startPage != null) {
                                window.location = 'yarn_list.html?startPage=' + startPage;
                            }
                            else {
                                window.location = 'yarn_list.html';
                            }
                        }
                    }]
                });
                
                yarnForm.render('yarnFormDiv');
				
                new Ext.Resizable('customImg', {
		            wrap:true,
		            pinned:true,
					dynamic:true,
				    handles: 'all',
				    draggable:true
				});
                
                if (idValue != null) {
                    document.getElementById('id').value = idValue;
                    yarnForm.getForm().load({
                        url: '../../servlet/BiYarnServlet?action=3&id=' + idValue,
                        waitMsg: Ext.LoadMask.prototype.msg,
						success: function(form, action){
							document.getElementById('customImg').src =  '../../_temp/' + document.getElementById('photoName').value;
						}
                    });
                }
            });
        </script>
    </head>
    <body>
        <div id="yarnFormDiv">
        </div>
		<img id="customImg" src="../../_temp/noimage.gif" style="position:absolute;left: 40%;width: 250px;"/>
    </body>
</html>
